package com.code_g.service;

import com.code_g.mapper.UserMapper;
import com.code_g.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.RollbackException;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    @Transactional
    public User queryById(int id){
        return userMapper.selectByPrimaryKey(id);
    }

    @Transactional
    public void saveUser(User user){
            userMapper.insertSelective(user);
    }
}
